package com.api.shopapi.service.impl;

import com.api.shopapi.entity.EHealthRecord;
import com.api.shopapi.entity.ServeclassServe;
import com.api.shopapi.mapper.EHealthRecordMapper;
import com.api.shopapi.service.EHealthRecordService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
@Service("EHealthRecordServiceImplOne")
public class EHealthRecordServiceImpl implements EHealthRecordService {


    @Autowired
    private EHealthRecordMapper eHealthRecordMapper;

    @Override
    public int insert(EHealthRecord eHealthRecord){
        return eHealthRecordMapper.insert(eHealthRecord);
    }

    @Override
    public int update(EHealthRecord eHealthRecord){
        return eHealthRecordMapper.update(eHealthRecord);
    }

    @Override
    public EHealthRecord getByEHealthRecordCode(String eHealthRecordCode){
        return eHealthRecordMapper.getByEHealthRecordCode(eHealthRecordCode);
    }

    @Override
    public PageInfo<EHealthRecord> getPageList(int pageIndex, int pageSize, String name,
                                               String hospital,
                                               String bloodTraVol,
                                               String reasonInfusion,
                                               int status,
                                               String isTime,
                                               Date startTime,
                                               Date endTime,
                                               String elderlyCode,
                                               Integer relation){
        PageHelper.startPage(pageIndex,pageSize);
        List<EHealthRecord> serveList =eHealthRecordMapper.getPageList(name,hospital,bloodTraVol,reasonInfusion,status,isTime,startTime,endTime,elderlyCode,relation);
        return new PageInfo<>(serveList);
    }

}
